
'use strict';

/**
	Part of Zombie Navigator
	Copyright © 2016  Zombie Navigator Developers
	
	@file
	@license AGPL-3.0+
*/


/*
	Zombie script example (= unprivileged)
	Do NOT require () this script from the addon code.
*/


const consoleType = typeof console;
do {
const {zombie, console} = require('zombie/zombie');
const {openWindow, openPrivateWindow, closeAll} = require('zombie/webbrowser');
const {run, delay} = require('zombie/async');

console.log('console:', consoleType);

run(function* () {
	let w = yield openPrivateWindow('about:');
	
	console.log(w);
	console.log(w.uri);
	yield w.runScript(function () {
		location.href = 'about:config';
		console.log (typeof window.wrappedObject);
	});
	
	yield w.waitForReload();
	console.log(w.uri);
	
	// unprivileged URI
	w.uri = 'data:,';
	yield w.waitForReload();
	console.log(w.uri);
	
	yield w.runScript(function () {
		location.href = 'about:config'; // denied
	});
	
	// this doesn't happen
	yield w.waitForReload();
	console.log(w.uri);
});

} while (false);

// vim: ts=4 noet ai

